/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "reserva_turno", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ReservaTurno.findAll", query = "SELECT r FROM ReservaTurno r"),
    @NamedQuery(name = "ReservaTurno.findByCliCod", query = "SELECT r FROM ReservaTurno r WHERE r.reservaTurnoPK.cliCod = :cliCod"),
    @NamedQuery(name = "ReservaTurno.findByCiEmp", query = "SELECT r FROM ReservaTurno r WHERE r.reservaTurnoPK.ciEmp = :ciEmp"),
    @NamedQuery(name = "ReservaTurno.findByReCob", query = "SELECT r FROM ReservaTurno r WHERE r.reservaTurnoPK.reCob = :reCob"),
    @NamedQuery(name = "ReservaTurno.findByReFecha", query = "SELECT r FROM ReservaTurno r WHERE r.reFecha = :reFecha"),
    @NamedQuery(name = "ReservaTurno.findByReEstado", query = "SELECT r FROM ReservaTurno r WHERE r.reEstado = :reEstado"),
    @NamedQuery(name = "ReservaTurno.findByHora", query = "SELECT r FROM ReservaTurno r WHERE r.hora = :hora")})
public class ReservaTurno implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ReservaTurnoPK reservaTurnoPK;
    @Column(name = "re_fecha")
    @Temporal(TemporalType.DATE)
    private Date reFecha;
    @Size(max = 10)
    @Column(name = "re_estado", length = 10)
    private String reEstado;
    @Column(name = "hora")
    @Temporal(TemporalType.TIME)
    private Date hora;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "reservaTurno")
    private DetReservatur detReservatur;
    @JoinColumn(name = "ci_emp", referencedColumnName = "ci_emp", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Empleado empleado;
    @JoinColumn(name = "cli_cod", referencedColumnName = "cli_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Clientes clientes;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "reservaTurno")
    private Collection<Servicios> serviciosCollection;

    public ReservaTurno() {
    }

    public ReservaTurno(ReservaTurnoPK reservaTurnoPK) {
        this.reservaTurnoPK = reservaTurnoPK;
    }

    public ReservaTurno(int cliCod, int ciEmp, int reCob) {
        this.reservaTurnoPK = new ReservaTurnoPK(cliCod, ciEmp, reCob);
    }

    public ReservaTurnoPK getReservaTurnoPK() {
        return reservaTurnoPK;
    }

    public void setReservaTurnoPK(ReservaTurnoPK reservaTurnoPK) {
        this.reservaTurnoPK = reservaTurnoPK;
    }

    public Date getReFecha() {
        return reFecha;
    }

    public void setReFecha(Date reFecha) {
        this.reFecha = reFecha;
    }

    public String getReEstado() {
        return reEstado;
    }

    public void setReEstado(String reEstado) {
        this.reEstado = reEstado;
    }

    public Date getHora() {
        return hora;
    }

    public void setHora(Date hora) {
        this.hora = hora;
    }

    public DetReservatur getDetReservatur() {
        return detReservatur;
    }

    public void setDetReservatur(DetReservatur detReservatur) {
        this.detReservatur = detReservatur;
    }

    public Empleado getEmpleado() {
        return empleado;
    }

    public void setEmpleado(Empleado empleado) {
        this.empleado = empleado;
    }

    public Clientes getClientes() {
        return clientes;
    }

    public void setClientes(Clientes clientes) {
        this.clientes = clientes;
    }

    @XmlTransient
    public Collection<Servicios> getServiciosCollection() {
        return serviciosCollection;
    }

    public void setServiciosCollection(Collection<Servicios> serviciosCollection) {
        this.serviciosCollection = serviciosCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (reservaTurnoPK != null ? reservaTurnoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReservaTurno)) {
            return false;
        }
        ReservaTurno other = (ReservaTurno) object;
        if ((this.reservaTurnoPK == null && other.reservaTurnoPK != null) || (this.reservaTurnoPK != null && !this.reservaTurnoPK.equals(other.reservaTurnoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.ReservaTurno[ reservaTurnoPK=" + reservaTurnoPK + " ]";
    }
    
}
